package com.example.player.domain.entity;

import android.graphics.Bitmap;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

import java.io.Serializable;
import java.util.Objects;


/**
 * 歌曲实体类
 * @author 朱文权
 * */
@Entity(tableName="songs")
public class Song implements Serializable {
    @PrimaryKey(autoGenerate = true)
    private Long sid;
    /**
     * 歌曲大小
     * */
    private String size;
    /**
     * 歌曲文件类型
     * */
    private String type;

    /**
     * 选中状态，不存入数据库
     * 0为初始化状态，1为选中状态，-1为未选中状态
     * */
    @Ignore
    private Integer selected=0;
    /**
     * 歌曲的播放状态
     * 0：未播放，1：资源加载中而未准备完成，2：正在播放，3：暂停，4：播放完毕
     * */
    @Ignore
    private Integer playStatus=0;
    private String title;
    @ColumnInfo(name="cover_path")
    private String coverPath;
    private String artist;
    private String duration;
    /**
     * 音乐所在路径
     * */
    @ColumnInfo(defaultValue = "path")
    private String path;

    public Integer getPlayStatus() {
        return playStatus;
    }

    public void setPlayStatus(Integer playStatus) {
        this.playStatus = playStatus;
    }

    /**
     * 文件所在位置是唯一标识符
     * */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Song song = (Song) o;
        return Objects.equals(path, song.path);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(path);
    }
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
    public Integer getSelected() {
        return selected;
    }

    public void setSelected(Integer selected) {
        this.selected = selected;
    }

    public String getSize() {
        return size;
    }

    public void setSize(String size) {
        this.size = size;
    }
    public Long getSid() {
        return sid;
    }
    public void setSid(Long sid) {
        this.sid = sid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCoverPath() {
        return coverPath;
    }

    public void setCoverPath(String coverPath) {
        this.coverPath = coverPath;
    }

    public String getArtist() {
        return artist;
    }

    public void setArtist(String artist) {
        this.artist = artist;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

}
